home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / Libraries / UGrabberTracker.cp < prev    next >
Encoding:
Text File  |  1991-05-01  |  2.4 KB  |  103 lines  |  [TEXT/MPS ]

  1. // UGrabberTracker.cp
  2. // Copyright © 1988-1991 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __UGRABBERTRACKER__
  5. #include "UGrabberTracker.h"
  6. #endif
  7.  
  8. #ifndef __UGEOMETRY__
  9. #include <UGeometry.h>
  10. #endif
  11.  
  12. #ifndef __UDOCUMENT__
  13. #include "UDocument.h"
  14. #endif
  15.  
  16. #ifndef __USCROLLER__
  17. #include "UScroller.h"
  18. #endif
  19.  
  20. #ifndef __UMACAPPUTILITIES__
  21. #include "UMacAppUtilities.h"
  22. #endif
  23.  
  24.  
  25. //--------------------------------------------------------------------------------------------------
  26. #pragma segment GrabberDoCommand
  27.  
  28. pascal void TGrabberTracker::IGrabberTracker(CmdNumber itsCmdNumber,
  29.                                              TDocument* itsDocument,
  30.                                              TView* itsView,
  31.                                              TScroller* itsScroller,
  32.                                              const VPoint& itsMouse)
  33.  
  34. {
  35.     this->INoChangesTracker(itsCmdNumber, itsDocument, itsView, itsScroller, itsMouse);
  36. }
  37.  
  38. //--------------------------------------------------------------------------------------------------
  39. #pragma segment GrabberDoCommand
  40.  
  41. pascal TTracker* TGrabberTracker::TrackMouse(TrackPhase aTrackPhase,
  42.                                              VPoint& anchorPoint,
  43.                                              VPoint& previousPoint,
  44.                                              VPoint& nextPoint,
  45.                                              Boolean mouseDidMove)// override 
  46.  
  47. {
  48.     switch (aTrackPhase)
  49.     {
  50.         case trackBegin:
  51.             break;
  52.  
  53.         case trackContinue:
  54.             if (mouseDidMove)
  55.             {
  56.                 VPoint delta = - fScroller->fTranslation;
  57.  
  58.                 delta.ConstrainTo(VRect(anchorPoint - nextPoint, fScroller->fMaxTranslation - fScroller->fTranslation));
  59.  
  60.                 if (delta != gZeroVPt)
  61.                 {
  62.                     fScroller->ScrollBy(delta, True);
  63.                     fScroller->Update();
  64.                 }
  65.  
  66.                 nextPoint += delta;
  67.  
  68.                 previousPoint = nextPoint;
  69.                 anchorPoint = nextPoint;
  70.             }
  71.             break;
  72.  
  73.         case trackEnd:
  74.             break;
  75.     }                                            // switch 
  76.     return this;                                // keep tracking with me 
  77. }
  78.  
  79. //--------------------------------------------------------------------------------------------------
  80. #pragma segment GrabberDoCommand
  81.  
  82. pascal void TGrabberTracker::TrackFeedback(TrackPhase /* aTrackPhase */,
  83.                                         const VPoint& /* anchorPoint */,
  84.                                         const VPoint& /* previousPoint */,
  85.                                         const VPoint& /* nextPoint */,
  86.                                         Boolean /* mouseDidMove */,
  87.                                         Boolean /* turnItOn */)// override
  88.  
  89. {
  90.     // NO feedback please 
  91. }
  92.  
  93. //--------------------------------------------------------------------------------------------------
  94. #pragma segment GrabberDoCommand
  95.  
  96. pascal void TGrabberTracker::AutoScroll(const VPoint& delta)// override
  97.  
  98. {
  99.     // NO AutoScroll please 
  100. }
  101.  
  102.  
  103.